home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
LDB171.ARJ
/
INTBDR.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-12
|
2KB
|
111 lines
/*
IntBdr.cpp -- Loose Data Binder v 1.7:
container class "form."
(C) Copyright 1992 John W. Small
All rights reserved
PSW / Power SoftWare
P.O. Box 10072
McLean, Virginia 22102 8072 USA
(703) 759-3838
See notes in fbinder.hpp!
*/
#ifndef IntBdr_HPP
#include "IntBdr.hpp"
#endif
int IntBdr::initData(/* IntBdr-declared data
member initializers */)
{
// initialize any IntBdr-declared data
// members here
return 1; // success
}
voiD IntBdr::Dassign(voiD D, const voiD S)
{
// invokes int's overloaded operator=()
(*(int *)D) = (*(int *)S);
return D;
}
voiD IntBdr::Dnew(const voiD D)
{
// invokes int's copy initializer constructor
return (voiD) new int(*(int *)D);
}
void IntBdr::Ddelete(voiD D)
{
// invokes int's destructor
delete (int *) D;
}
void IntBdr::Dstore(ostream& os, voiD D)
{
// invokes operator<<(ostream&,int&)
os << *(int *)D << BDRendm;
}
voiD IntBdr::Dload(istream& is)
{
int tmp;
is >> tmp >> BDRnextm;
return (voiD) new int(tmp);
}
void IntBdr::store(ostream& os)
{
Binder::store(os);
// os << IntBdr-declared data members << BDRendm;
// if (!os)
// berror("unable to store IntBdr "
// "data on stream");
}
IntBdR IntBdr::load(istream& is, IntBdR thiS)
{
int newed;
// is >> IntBdr-declared data member initializers
// >> BDRnextm;
// if (!is) {
// sberror("unable to load IntBdr "
// "data from stream");
// return IntBdR0;
// }
if (thiS)
newed = 0;
else {
if ((thiS = new IntBdr(initVFTsOnly))
== IntBdR0) {
sberror("unable to construct "
"new IntBdr for "
"loading");
return IntBdR0;
}
newed = 1;
}
if (!Binder::load(is,(BindeR)thiS)) {
if (newed)
delete (voiD) thiS;
return IntBdR0;
}
if (!thiS->initData(/* IntBdr-declared data
member initializers */)) {
sberror("nunable to initialize IntBdr "
"from reloaded stream data");
if (newed)
delete (voiD) thiS;
return IntBdR0;
}
return thiS;
}